Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Precompute decode hooks for performance reason#324

Open
Succo wants to merge 2 commits into
mitchellh:mainfrom
Succo:perf
Open

Precompute decode hooks for performance reason#324
Succo wants to merge 2 commits into
mitchellh:mainfrom
Succo:perf

Conversation

@Succo

@Succo Succo commented Apr 14, 2023

Copy link
Copy Markdown

When using this library with ComposeDecodeHook we noticed some performance degration. After further investigation, it seems that a lot of time is spent inside typedDecodeHook on reflect func.

I think it would be possible to precompute the typedDecodeHook for all hooks given to ComposeDecodeHook. I applied the same patch to OrComposeDecodeHookFunc event though we don't use it.

@Succo

Succo commented Apr 14, 2023

Copy link
Copy Markdown
Author

Some of the comments got updated due to gofmt change in behaviour.

I can revert this part if it's a problem (or open a different PR just for it)

@cedric-cordenier

Copy link
Copy Markdown

@mitchellh We've noticed the same performance issues as @Succo . Are there any plans to merge this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants